package com.hands.sample.controller;

import com.hands.commen.entity.domain.MessageInfo;
import com.hands.commen.entity.wx.HostInfo;
import com.hands.sample.service.HostInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 主机mac地址绑定房间号信息
 */
@RestController
@RequestMapping("v1/host")
public class HostInfoController {

    @Autowired
    private HostInfoService hostInfoService;

    /**
     * 新增注册接口（通用，未做限制）
     * @param hostInfo
     */
    @PostMapping("add")
    public MessageInfo  insertInfo(@RequestBody  HostInfo hostInfo){

        int i = hostInfoService.insertInfo(hostInfo);

        return MessageInfo.isSuccess(200,"执行成功",i);
    }

    /**
     * 通用查询接口
     * @param hostInfo
     * @return
     */
    @GetMapping("find")
    public MessageInfo findInfo(HostInfo hostInfo){

        List<HostInfo> hostInfos = hostInfoService.selectHostInfoList(hostInfo);

        System.out.println(hostInfos);

        return MessageInfo.isSuccess(200,"查询成功",hostInfos);
    }


}
